package com.dqyt.app.controller;

import com.alibaba.fastjson.JSON;
import com.dqyt.app.service.AppLhqReportService;
import com.dqyt.khjc.bean.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 报告控制器
 */
@RestController
public class AppLhqReportController {

    /**
     *
     */
    @Autowired
    private AppLhqReportService appLhqReportService;

    /**
     *  分页查询报告
     * @param request
     * @param userId  用户id
     * @param token
     * @param addTime
     * @param reportStatue  报告状态
     * @param erweima  二维码
     * @param deviceType  设备类型
     * @param reportProgress  报告进度
     * @return
     */
    @RequestMapping("/sample/getReportInfosLhq")
    public String getReportInfosLhq(HttpServletRequest request, int page, int size, long userId,
                                 String token, long addTime, int deviceType, int reportStatue, int reportProgress , String bsbh, String erweima, long wtfId) {
        return JSON.toJSONString(appLhqReportService.getReportInfosLhq(request,page,size, userId, token, addTime, reportStatue, bsbh, erweima,deviceType,reportProgress,wtfId));
    }



    /**
     * 驳回报告
     * @param request
     * @return
     */
    @RequestMapping(value = "/sample/rejectLhqReportDal", method = {RequestMethod.POST})
    public ResultMsg rejectLhqReportDal(HttpServletRequest request, long userId, String token, String bh, int reportProgress, String bhgyy){
        ResultMsg resultMsg = appLhqReportService.rejectLhqReportDal(request,userId,token,bh, reportProgress,bhgyy);
        return resultMsg;
    }


    /**
     * 报告通过审核
     * @param request
     * @return
     */
    @RequestMapping(value = "/sample/reportLhqAdoptExamine", method = {RequestMethod.POST})
    public ResultMsg  reportLhqAdoptExamine(HttpServletRequest request,long userId, String token,String bh){
        ResultMsg resultMsg = appLhqReportService.reportLhqAdoptExamine(request,userId,token,bh);
        return resultMsg;
    }



    /**
     * 报告通过批准
     * @param request
     * @return
     */
    @RequestMapping(value = "/sample/reportLhqAdoptApproval", method = {RequestMethod.POST})
    public ResultMsg  reportLhqAdoptApproval(HttpServletRequest request,long userId, String token,String bh){
        ResultMsg resultMsg = appLhqReportService.reportLhqAdoptApproval(request,userId,token,bh);
        return resultMsg;
    }


}
